package com.vn.entity;

import java.util.Date;
import java.util.List;

import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.Column;


@Entity
@Table(name="Building")
public class Building {
	public Building(){}
	
	public Building(String id, Land land, BuildingType buildingType,
			String name, int numFloor, int numCompartment,
			short buildingPermit, Date dateReceiveBuildingPermit,
			Date startDateConstruction, Date completeDateConstruction,
			Storage storage, String log, boolean deleted) {
		super();
		this.id = id;
		this.land = land;
		this.buildingType = buildingType;
		this.name = name;
		this.numFloor = numFloor;
		this.numCompartment = numCompartment;
		this.buildingPermit = buildingPermit;
		this.dateReceiveBuildingPermit = dateReceiveBuildingPermit;
		this.startDateConstruction = startDateConstruction;
		this.completeDateConstruction = completeDateConstruction;
		this.storage = storage;
		this.log = log;
		this.deleted = deleted;
	}

	@Id
	@Column(name="IDBuilding")
	private String id;
	
	@JoinColumn(name="LandID",referencedColumnName="IDLand")
	@ManyToOne
	private Land land;
	
	@JoinColumn(name="BuildingTypeID",referencedColumnName="IDBuildingType")
	@ManyToOne
	private BuildingType buildingType;
	
	@Column(name="Name")
	private String name;
	
	@Column(name="NumFloor")
	private int numFloor;
	
	@Column(name="NumCompartment")
	private int numCompartment;
	
	@Column(name="BuildingPermit")
	private short buildingPermit=0;
	
	@Column(name="DateReceiveBuildingPermit")
	private Date dateReceiveBuildingPermit;
	
	@Column(name="StartDateConstruction")
	private Date startDateConstruction;
	
	@Column(name="CompleteDateConstruction")
	private Date completeDateConstruction;
	
	@JoinColumn(name="FolderName",referencedColumnName="FolderName")
	@ManyToOne
	private Storage storage;
	
	@Column(name="Log")
	private String log;
	
	@Column(name="Deleted")
	private boolean deleted=false;
	
	@OneToMany
	private List<Compartment> compartments;

	public String getId() {
		return id;
	}

	public void setId(String id) {
		this.id = id;
	}

	public Land getLand() {
		return land;
	}

	public void setLand(Land land) {
		this.land = land;
	}

	public BuildingType getBuildingType() {
		return buildingType;
	}

	public void setBuildingType(BuildingType buildingType) {
		this.buildingType = buildingType;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public int getNumFloor() {
		return numFloor;
	}

	public void setNumFloor(int numFloor) {
		this.numFloor = numFloor;
	}

	public int getNumCompartment() {
		return numCompartment;
	}

	public void setNumCompartment(int numCompartment) {
		this.numCompartment = numCompartment;
	}

	public Date getDateReceiveBuildingPermit() {
		return dateReceiveBuildingPermit;
	}

	public void setDateReceiveBuildingPermit(Date dateReceiveBuildingPermit) {
		this.dateReceiveBuildingPermit = dateReceiveBuildingPermit;
	}

	public Date getStartDateConstruction() {
		return startDateConstruction;
	}

	public void setStartDateConstruction(Date startDateConstruction) {
		this.startDateConstruction = startDateConstruction;
	}

	public Date getCompleteDateConstruction() {
		return completeDateConstruction;
	}

	public void setCompleteDateConstruction(Date completeDateConstruction) {
		this.completeDateConstruction = completeDateConstruction;
	}

	public Storage getStorage() {
		return storage;
	}

	public void setStorage(Storage storage) {
		this.storage = storage;
	}

	public String getLog() {
		return log;
	}

	public void setLog(String log) {
		this.log = log;
	}

	public boolean isDeleted() {
		return deleted;
	}

	public void setDeleted(boolean deleted) {
		this.deleted = deleted;
	}

	public short getBuildingPermit() {
		return buildingPermit;
	}

	public void setBuildingPermit(short buildingPermit) {
		this.buildingPermit = buildingPermit;
	}

	public List<Compartment> getCompartments() {
		return compartments;
	}

	public void setCompartments(List<Compartment> compartments) {
		this.compartments = compartments;
	}	
}
